﻿Option Strict On
Option Explicit On

Imports CObject
Imports ConnectionServer
Imports System.Data.SqlClient
Imports Objects.Utility

Namespace CMT
    Public Class CMTClientRegistration
        Inherits CObject.CObject


#Region "Overrides Things"
        Public Overrides Function Clone() As CObject.CObject
            Return New CMTClientRegistration
        End Function

        Public Overrides ReadOnly Property Key As String
            Get
                Return "ClientId"
            End Get
        End Property

        Protected Overrides Function ProcedureSigniture(ByVal peCommandType As CObject.CommandType) As String
            Select Case peCommandType
                Case CommandType.SQLSelect
                    Return "EXEC CMT_GetSpecificMeetingDetails {MeetingID}"
                Case CommandType.SQLInsert
                    Return "EXEC CMT_AddClientRegDetails {Name}, {Country}, {Industry}, {Role}, {Mobile}, {EmailAddress}, {Preferences}, {AvailableStartDate1}, {AvailableEndDate1}, {AvailableStartDate2}, {AvailableEndDate2}, {AvailableStartDate3}, {AvailableEndDate3}, {Approximatetimereq} ,{IsPrivatemeetings}, {PrivateMeetingLocation}, {PrivateMeetingTime}, {MeetingTypes}, {RequirementofTranslators}, {setuprequirements}, {Cateringrequirements} ,{PartnerCOuntryName}, {SpecialIssues}, {IsPriorityClient}, {CreatedBy}, {IsParticipationConfirmed}, {EventId},{EventAttendeeID}"
                Case CommandType.SQLUpdate
                    Return "EXEC CMT_UpdateClientRegDetails {ClientId}, {Name}, {Country}, {Industry}, {Role}, {Mobile}, {EmailAddress}, {Preferences}, {AvailableStartDate1}, {AvailableEndDate1}, {AvailableStartDate2}, {AvailableEndDate2}, {AvailableStartDate3}, {AvailableEndDate3}, {Approximatetimereq} ,{IsPrivatemeetings}, {PrivateMeetingLocation}, {PrivateMeetingTime}, {MeetingTypes}, {RequirementofTranslators}, {setuprequirements}, {Cateringrequirements} ,{PartnerCOuntryName}, {SpecialIssues}, {IsPriorityClient}, {CreatedBy}, {IsParticipationConfirmed}, {EventId},{EventAttendeeID}"
                Case Else
                    Throw New SystemException("Invalid Command Type")
            End Select
        End Function

        Public Overrides ReadOnly Property SourceDataBase As ConnectionServer.Connection.SourceDataBase
            Get
                Return Connection.SourceDataBase.CMT
            End Get
        End Property
#End Region

#Region "Properties"
        Public Property ClientId() As Integer
            Get
                Return CastToInteger(GetProperty("ClientId"))
            End Get
            Set(ByVal value As Integer)
                SetProperty("ClientId", value)
            End Set
        End Property

        Public Property Name() As String
            Get
                Return CastToString(GetProperty("Name"))
            End Get
            Set(ByVal value As String)
                SetProperty("Name", value)
            End Set
        End Property


        Public Property Country() As String
            Get
                Return CastToString(GetProperty("Country"))
            End Get
            Set(ByVal value As String)
                SetProperty("Country", value)
            End Set
        End Property

        Public Property Industry() As String
            Get
                Return CastToString(GetProperty("Industry"))
            End Get
            Set(ByVal value As String)
                SetProperty("Industry", value)
            End Set
        End Property
        Public Property Role() As String
            Get
                Return CastToString(GetProperty("Role"))
            End Get
            Set(ByVal value As String)
                SetProperty("Role", value)
            End Set
        End Property
        Public Property Mobile() As String
            Get
                Return CastToString(GetProperty("Mobile"))
            End Get
            Set(ByVal value As String)
                SetProperty("Mobile", value)
            End Set
        End Property
        Public Property EmailAddress() As String
            Get
                Return CastToString(GetProperty("EmailAddress"))
            End Get
            Set(ByVal value As String)
                SetProperty("EmailAddress", value)
            End Set
        End Property

        Public Property Preferences() As String
            Get
                Return CastToString(GetProperty("Preferences"))
            End Get
            Set(ByVal value As String)
                SetProperty("Preferences", value)
            End Set
        End Property

        Public Property ApproximateTimeReq() As String
            Get
                Return CastToString(GetProperty("Approximatetimereq"))
            End Get
            Set(ByVal value As String)
                SetProperty("Approximatetimereq", value)
            End Set
        End Property

        Public Property MeetingTypes() As String
            Get
                Return CastToString(GetProperty("MeetingTypes"))
            End Get
            Set(ByVal value As String)
                SetProperty("MeetingTypes", value)
            End Set
        End Property

        Public Property SetupRequirements() As String
            Get
                Return CastToString(GetProperty("setuprequirements"))
            End Get
            Set(ByVal value As String)
                SetProperty("setuprequirements", value)
            End Set
        End Property

        Public Property CateringRequirements() As String
            Get
                Return CastToString(GetProperty("Cateringrequirements"))
            End Get
            Set(ByVal value As String)
                SetProperty("Cateringrequirements", value)
            End Set
        End Property

        Public Property PrivateMeetingLocation() As String
            Get
                Return CastToString(GetProperty("PrivateMeetingLocation"))
            End Get
            Set(ByVal value As String)
                SetProperty("PrivateMeetingLocation", value)
            End Set
        End Property

        Public Property AvailableStartDate1() As Date
            Get
                Return CastToDate(GetProperty("AvailableStartDate1"))
            End Get
            Set(ByVal value As Date)
                SetProperty("AvailableStartDate1", value)
            End Set
        End Property

        Public Property AvailableEndDate1() As Date
            Get
                Return CastToDate(GetProperty("AvailableEndDate1"))
            End Get
            Set(ByVal value As Date)
                SetProperty("AvailableEndDate1", value)
            End Set
        End Property

        Public Property AvailableStartDate2() As Date
            Get
                Return CastToDate(GetProperty("AvailableStartDate2"))
            End Get
            Set(ByVal value As Date)
                SetProperty("AvailableStartDate2", value)
            End Set
        End Property
        Public Property AvailableEndDate2() As Date
            Get
                Return CastToDate(GetProperty("AvailableEndDate2"))
            End Get
            Set(ByVal value As Date)
                SetProperty("AvailableEndDate2", value)
            End Set
        End Property
        Public Property AvailableStartDate3() As Date
            Get
                Return CastToDate(GetProperty("AvailableStartDate3"))
            End Get
            Set(ByVal value As Date)
                SetProperty("AvailableStartDate3", value)
            End Set
        End Property
        Public Property AvailableEndDate3() As Date
            Get
                Return CastToDate(GetProperty("AvailableEndDate3"))
            End Get
            Set(ByVal value As Date)
                SetProperty("AvailableEndDate3", value)
            End Set
        End Property

        Public Property IsPrivateMeetings As Boolean
            Get
                Return CastToBoolean(GetProperty("IsPrivatemeetings"))
            End Get
            Set(ByVal value As Boolean)
                SetProperty("IsPrivatemeetings", value)
            End Set
        End Property

        Public Property PrivateMeetingTime() As Date
            Get
                Return CastToDate(GetProperty("PrivateMeetingTime"))
            End Get
            Set(ByVal value As Date)
                SetProperty("PrivateMeetingTime", value)
            End Set
        End Property

        Public Property RequirementofTranslators As Boolean
            Get
                Return CastToBoolean(GetProperty("RequirementofTranslators"))
            End Get
            Set(ByVal value As Boolean)
                SetProperty("RequirementofTranslators", value)
            End Set
        End Property


        Public Property IsPriorityClient As Boolean
            Get
                Return CastToBoolean(GetProperty("IsPriorityClient"))
            End Get
            Set(ByVal value As Boolean)
                SetProperty("IsPriorityClient", value)
            End Set
        End Property
        Public Property IsActive As Boolean
            Get
                Return CastToBoolean(GetProperty("IsActive"))
            End Get
            Set(ByVal value As Boolean)
                SetProperty("IsActive", value)
            End Set
        End Property
        Public Property IsParticipationConfirmed As Boolean
            Get
                Return CastToBoolean(GetProperty("IsParticipationConfirmed"))
            End Get
            Set(ByVal value As Boolean)
                SetProperty("IsParticipationConfirmed", value)
            End Set
        End Property


        Public Property PartnerCOuntryName() As String
            Get
                Return CastToString(GetProperty("PartnerCOuntryName"))
            End Get
            Set(ByVal value As String)
                SetProperty("PartnerCOuntryName", value)
            End Set
        End Property

        Public Property SpecialIssues() As String
            Get
                Return CastToString(GetProperty("SpecialIssues"))
            End Get
            Set(ByVal value As String)
                SetProperty("SpecialIssues", value)
            End Set
        End Property

        Public Property EventId() As Integer
            Get
                Return CastToInteger(GetProperty("EventId"))
            End Get
            Set(ByVal value As Integer)
                SetProperty("EventId", value)
            End Set
        End Property

        Public Property CreatedBy() As String
            Get
                Return CastToString(GetProperty("CreatedBy"))
            End Get
            Set(ByVal value As String)
                SetProperty("CreatedBy", value)
            End Set
        End Property
        Public Property EventAttendeeID() As Integer
            Get
                Return CastToInteger(GetProperty("EventAttendeeID"))
            End Get
            Set(ByVal value As Integer)
                SetProperty("EventAttendeeID", value)
            End Set
        End Property

#End Region

#Region "Methods"

        Public Shared Function GetCountryDetails() As DataTable
            Using loConn As Connection = New Connection(Connection.SourceDataBase.CMT)
                Dim lsSQl As String = String.Empty
                Dim loDT As DataTable
                lsSQl = "EXEC CMT_GetAllCountrys"
                loDT = loConn.GetDataTable(lsSQl)
                Return loDT
            End Using
        End Function
        Public Shared Function GetClientCountryDetails(ByVal eventID As String) As DataTable
            Using loConn As Connection = New Connection(Connection.SourceDataBase.CMT)
                Dim lsSQl As String = String.Empty
                Dim loDT As DataTable
                lsSQl = "EXEC CMT_GetClientCoutryList " & eventID & ""
                loDT = loConn.GetDataTable(lsSQl)
                Return loDT
            End Using
        End Function
        Public Shared Function GetRegistrationDetailsForAnAttendee(ByVal attendeeID As String) As DataTable
            Using loConn As Connection = New Connection(Connection.SourceDataBase.CMT)
                Dim lsSQL As String = "EXEC GetClientRegDetailsByAttendee " & attendeeID & ""
                Dim loDT As DataTable
                loDT = loConn.GetDataTable(lsSQL)
                Return loDT
            End Using
        End Function

        Public Shared Function GetAllEventsForAnUser(ByVal userID As String) As DataTable
            Using loConn As Connection = New Connection(Connection.SourceDataBase.CMT)
                Dim lsSQL As String = "EXEC GetEventsforAdmin " & userID & ""
                Dim loDT As DataTable
                loDT = loConn.GetDataTable(lsSQL)
                Return loDT
            End Using
        End Function

        Public Shared Function GetClientsForHost(ByVal eventattendeeId As Integer) As DataTable
            Using loConn As Connection = New Connection(Connection.SourceDataBase.CMT)
                Dim lsSQL As String = "EXEC CMT_GetEventAttendeesDetailsByHost " & eventattendeeId & ""
                Dim loDT As DataTable
                loDT = loConn.GetDataTable(lsSQL)
                Return loDT
            End Using
        End Function

        Public Shared Function GetRegistrationDetailsForAnEvent(ByVal eventID As Integer) As DataTable
            Using loConn As Connection = New Connection(Connection.SourceDataBase.CMT)
                Dim lsSQL As String = "EXEC GetClientRegDetailsByEvent " & eventID & ""
                Dim loDT As DataTable
                loDT = loConn.GetDataTable(lsSQL)
                Return loDT
            End Using
        End Function


#End Region



    End Class
End Namespace

